package com.zhuang.chapter09.work02;

public class CargoBoat {
	private int realcontent;
	private int maxcontent;

	public int getRealcontent() {
		return realcontent;
	}

	public void setRealcontent(int realcontent) {
		this.realcontent = realcontent;
	}

	public int getMaxcontent() {
		return maxcontent;
	}

	public void setMaxcontent(int maxcontent) {
		this.maxcontent = maxcontent;
	}

	public void loading(int m) throws DangerException {
		this.realcontent += m;
		if (realcontent > maxcontent) {
			throw new DangerException();
		}
		System.out.printf("目前装载了%d吨的货物\n", realcontent);
	}
}
